package perso.perso.view.tools;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;

public class Properties {

	java.util.Properties p = new java.util.Properties();
	
	private Properties(){
		try {
			InputStream f = this.getClass().getClassLoader()  
	                .getResourceAsStream("sendRequest.properties");
			if(f != null){
				p.load(f);
			}
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} 
	}
	
	private static Properties instance = new Properties();
	
	public static Properties getInstance() {return instance;}
	
	public String getProperty(String key){
		return p.getProperty(key);
	}
	
	private String middlewarePort;
	private String middlewareUrl;
	
//	private String proxyHost;
//	private String proxyPort;
	
	public String getMiddlewareUrl(){
		if(middlewareUrl == null){
			middlewareUrl = p.getProperty(PersoViewConstant.MIDDLEWAREURL);
		}
		return middlewareUrl;
	}
	
	
	
	public void setMiddlewareUrl(String middlewareUrl) {
		this.middlewareUrl = middlewareUrl;
	}

	public String getMiddlewarePort() {
		if(middlewarePort == null){
			middlewarePort = p.getProperty(PersoViewConstant.MIDDLEWAREPORT);
		}
		return middlewarePort;
	}

	public void setMiddlewarePort(String middlewarePort) {
		this.middlewarePort = middlewarePort;
	}
	
	
	
	
}
